home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #3 / Amiga Plus CD - 2002 - No. 03.iso / AmigaPlus / AmigaOS / Aplus_Dev / AP-Website / links / include / main.cats.php < prev    next >
Encoding:
PHP Script  |  2002-10-28  |  3.2 KB  |  97 lines

  1. <?
  2. // *******************************************************************
  3. //  include/main.cats.php
  4. // *******************************************************************
  5.  
  6. $cnt_array = sql_fetch_array(
  7.     sql_query("
  8.         select
  9.             Count(*) as Total
  10.         from
  11.             $tb_categories
  12.         where
  13.             PID='$PID'
  14.     ")
  15. );
  16.  
  17. $num_rows = $cnt_array[Total];
  18.  
  19. if($num_rows > 0){
  20.  
  21.     if($colcount == 2){
  22.  
  23.         $num_rows % 2  ? $num_rows += 1 : $num_rows;
  24.         $rows = $num_rows / 2;
  25.  
  26.         $html = $main_table . "<tr>\r\n\t\t\t<td ";
  27.         $html .= "width=\"50%\" valign=\"top\" class=\"maincats\" ";
  28.         $html .= "nowrap=\"nowrap\" align=\"left\">";
  29.         $html .= build_cat("0", $rows, $PID);
  30.         $html .= "\r\n\t\t\t</td>\r\n\t\t\t<td width=\"50%\" valign=\"top\" ";
  31.         $html .= "class=\"maincats\" nowrap=\"nowrap\" align=\"left\">";
  32.         $html .= build_cat($rows, $rows, $PID);
  33.         $html .= "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</table>\r\n\r\n";
  34.  
  35.         echo table("100%", "center", "", $html);
  36.     }
  37.  
  38.     if($colcount == 3){
  39.  
  40.         $num_rows % 3  ? $num_rows += 1 : $num_rows;
  41.         $num_rows % 3  ? $num_rows += 1 : $num_rows;
  42.         $rows = $num_rows / 3;
  43.         $rows2 = ($rows * 2);
  44.  
  45.         $html = $main_table . "<tr>\r\n\t\t\t<td ";
  46.         $html .= "width=\"33%\" valign=\"top\" class=\"maincats\" ";
  47.         $html .= "nowrap=\"nowrap\" align=\"left\">";
  48.         $html .= build_cat("0", $rows, $PID);
  49.         $html .= "\r\n\t\t\t</td>\r\n\t\t\t<td width=\"33%\" valign=\"top\" ";
  50.         $html .= "class=\"maincats\" nowrap=\"nowrap\" align=\"left\">";
  51.         $html .= build_cat($rows, $rows, $PID);
  52.         $html .= "\r\n\t\t\t</td>\r\n\t\t\t<td width=\"34%\" valign=\"top\" ";
  53.         $html .= "class=\"maincats\" nowrap=\"nowrap\" align=\"left\">";
  54.         $html .= build_cat($rows2, $rows, $PID);
  55.         $html .= "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</table>\r\n\r\n";
  56.  
  57.         echo table("100%", "center", "", $html);
  58.     }
  59.  
  60.     if($colcount == 4){
  61.  
  62.         $num_rows % 4  ? $num_rows += 1 : $num_rows;
  63.         $num_rows % 4  ? $num_rows += 1 : $num_rows;
  64.         $num_rows % 4  ? $num_rows += 1 : $num_rows;
  65.  
  66.         $rows = $num_rows / 4;
  67.         $rows2 = ($rows * 2);
  68.         $rows3 = ($rows * 3);
  69.  
  70.         $html = $main_table . "<tr>\r\n\t\t\t<td ";
  71.         $html .= "width=\"25%\" valign=\"top\" class=\"maincats\" ";
  72.         $html .= "nowrap=\"nowrap\" align=\"left\">";
  73.         $html .= build_cat("0", $rows, $PID);
  74.         $html .= "\r\n\t\t\t</td>\r\n\t\t\t<td width=\"25%\" valign=\"top\" ";
  75.         $html .= "class=\"maincats\" nowrap=\"nowrap\" align=\"left\">";
  76.         $html .= build_cat($rows, $rows, $PID);
  77.         $html .= "\r\n\t\t\t</td>\r\n\t\t\t<td width=\"25%\" valign=\"top\" ";
  78.         $html .= "class=\"maincats\" nowrap=\"nowrap\" align=\"left\">";
  79.         $html .= build_cat($rows2, $rows, $PID);
  80.         $html .= "\r\n\t\t\t</td>\r\n\t\t\t<td width=\"25%\" valign=\"top\" ";
  81.         $html .= "class=\"maincats\" nowrap=\"nowrap\" align=\"left\">";
  82.         $html .= build_cat($rows3, $rows, $PID);
  83.         $html .= "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</table>\r\n\r\n";
  84.  
  85.         echo table("100%", "center", "", $html);
  86.     }
  87. }
  88.  
  89. $fortune = "N";
  90. $html = $table4 . "<tr>\r\n\t\t\t<td ";
  91. $html .= "width=\"100%\" valign=\"top\"";
  92. $html .= " align=\"left\" class=\"fortune\">" . fortune();
  93. $html .= "</td>\r\n\t\t</tr>\r\n\t\t</table>\r\n\r\n";
  94. if($fortune == "Y" && $PID == 0){echo table("98%", "center", "", $html);}
  95.  
  96. ?>
  97.